package com.liuzhilong.infrastructure.basic.decorator.chain.impl;

import com.liuzhilong.infrastructure.basic.decorator.chain.Message;
import com.liuzhilong.infrastructure.basic.decorator.chain.MessageHandler;
import com.liuzhilong.infrastructure.basic.decorator.chain.MessageHandlerChain;

/**
 *
 */
public class OtherDailyReportEmitter implements MessageHandler {
    static {
        new OtherDailyReportEmitter().init();
    }
    //初始化一个
    private void init(){
        MessageHandlerChain.append(this);
    }


    @Override
    public int getOrder() {
        return 2;
    }

    @Override
    public void exec(Message message, MessageHandlerChain messageHandlerChain) {
        if(message.getMsg().contains("每日日报")&&"OtherDailyReportEmitter".equalsIgnoreCase(message.getFromWxid())){
            System.out.println("我是OtherDailyReportEmitter,我处理每日日报");
        }else {//不属于自己的请继续
            messageHandlerChain.exec(message);
        }
    }
}
